<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
	protected function _initSession(){
		//Zend_Session::setOptions(array('strict' => true)); //set
		Zend_Session::start();
	}
	protected function _initDb() {
		// $dbOption = $this->getOption('resources');
		// $dbOption = $dbOption['db'];


		// Setup database
		//$db = Zend_Db::factory($dbOption['adapter'],$dbOption['params']);


		$dbConfig = new Zend_Config_Ini ( APPLICATION_PATH . '/configs/application.ini', 'database' );
		//dua cac thong so vao tham so toan cuc
		Zend_Registry::set ( 'dbConfig', $dbConfig );

		// Ket noi database
		$db = Zend_Db::factory ( $dbConfig->resource->db->adapter, $dbConfig->resource->db->params->toArray () );

		$db->setFetchMode ( Zend_Db::FETCH_ASSOC );
		$db->query ( "SET NAMES 'utf8'" );
		$db->query ( "SET CHARACTER SET 'utf8'" );

		Zend_Registry::set ( 'db', $db );
		$profiler = $db->getProfiler();
		$profiler->setEnabled(true);
		//Khi thiet lap che do nay model moi co the su dung duoc
		Zend_Db_Table::setDefaultAdapter ( $db );

		// Return it, so that it can be stored by the bootstrap
		return $db;
	}
	protected function _initHelper(){
		
	}
	protected function _initDefineConstant(){
		defined('EMAIL_ACCOUNT')||define('EMAIL_ACCOUNT','nkkhoakhoa@yahoo.com');
	}

	protected function _initLoadRouter(){

	}
	/**
	 * _initLoadAccessRole
	 * - Phan quyen cho admin
	 */
	protected function _initLoadAccessRole(){
		
	}
}